//
//  BaseModel.h
//  BaseProject
//
//  Created by Macx on 2018/2/24.
//  Copyright © 2018年 Gavin. All rights reserved.
//  基础model，其他model直接继承即可调用接口，进行自动解析。

#import <Foundation/Foundation.h>
#import "NSObject+YYModel.h"
#import "ResultModel.h"
#import "BaseRequest.h"

@class BaseRequest;
@class OtherRequestAPI;
@class ResultModel;

/**
 request:请求对象
 resultModel:请求结果反馈对象
 **/
typedef void(^SuccessBlock)(__kindof BaseRequest *request,ResultModel *resultModel);

typedef void(^FailBlock)(__kindof BaseRequest *request,ResultModel *resultModel);

@interface BaseModel : NSObject

@property (nonatomic ,assign) NSInteger pageSize;

@property (nonatomic ,assign) NSInteger pageIndex;

@property (nonatomic ,assign) NSInteger total;

@property (nonatomic ,strong) NSArray *results;
//2023.08.01新增
+ (void)startWithCompletionAPIKey:(NSString *)apiKey
                         header:(NSDictionary*)header
                         argument:(NSDictionary *)arguments
                   requestSuccess:(SuccessBlock)success
                      requestFail:(FailBlock)fail;

/**POST
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startWithCompletionAPIKey:(NSString *)apiKey
                         argument:(NSDictionary *)arguments
                   requestSuccess:(SuccessBlock)success
                      requestFail:(FailBlock)fail;


/**GET
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startGetWithCompletionAPIKey:(NSString *)apiKey
                         argument:(NSDictionary *)arguments
                   requestSuccess:(SuccessBlock)success
                      requestFail:(FailBlock)fail;

/**PUT
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startPutWithCompletionAPIKey:(NSString *)apiKey
                         argument:(NSDictionary *)arguments
                   requestSuccess:(SuccessBlock)success
                      requestFail:(FailBlock)fail;


/**DELETE
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startDeleteWithCompletionAPIKey:(NSString *)apiKey
                         argument:(NSDictionary *)arguments
                   requestSuccess:(SuccessBlock)success
                      requestFail:(FailBlock)fail;


/**Other
 baseUrl:服务端地址
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 requestMethod:请求方式
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startWithBaseUrl:(NSString *)baseUrl
                  APIKey:(NSString *)apiKey
                argument:(NSDictionary *)arguments
           requestMethod:(RequestMethod)method
          requestSuccess:(SuccessBlock)success
             requestFail:(FailBlock)fail;


/**Upload
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 image:图片
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startUploadWithCompletionAPIKey:(NSString *)apiKey
                                 rgument:(NSDictionary *)arguments
                                   image:(UIImage *)image
                              imageName:(NSString *)imageName
                          requestSuccess:(SuccessBlock)success
                             requestFail:(FailBlock)fail;

/**上传文件
 apiKey:接口调用模块关键字，关键字统一存放于 URLMacros.h相关文件中  如：/user/login.do
 arguments:请求参数
 filePath:文件路径
 success:请求成功回调
 fail:请求失败回调
 **/
+ (void)startUploaFiledWithCompletionAPIKey:(NSString *)apiKey
                                 rgument:(NSDictionary *)arguments
                                   filePath:(NSString *)filePath
                          requestSuccess:(SuccessBlock)success
                             requestFail:(FailBlock)fail;

@end
